﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using RandomStudent.Mab.Attributes;
namespace RandomStudent.Mab
{
    /// <summary>
    /// 通过反射获取 method的 commandname 然后 加载进 系统
    /// </summary>
    public class MethodController
    {
        

        public static void GetMethods(object target)
        {
            MethodInfo[] methods = target.GetType().GetMethods();
            foreach (var method in methods)
            {
                CommandHandlerAttribute attribute = method.GetCustomAttribute<CommandHandlerAttribute>();
                //得到有 CommandHandler标记的方法
                if (attribute != null)
                {
                    string commandName = attribute.CommandName;
                }
            }

        }
    }
}
